//
// CPSSoundInstanceImpl.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;

public class CPSSoundInstanceImpl {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CPSSoundInstanceImpl(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CPSSoundInstanceImpl obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CPSSoundInstanceImpl(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CPSSoundInstanceImpl() {
    this(nel3dJNI.new_CPSSoundInstanceImpl(), true);
  }

  public void init(SWIGTYPE_p_NLSOUND__USource source, CPSSoundServImpl soundServImp, boolean spawned) {
    nel3dJNI.CPSSoundInstanceImpl_init(swigCPtr, this, SWIGTYPE_p_NLSOUND__USource.getCPtr(source), CPSSoundServImpl.getCPtr(soundServImp), soundServImp, spawned);
  }

  public void setSoundParams(float gain, CVector pos, CVector velocity, float pitch) {
    nel3dJNI.CPSSoundInstanceImpl_setSoundParams(swigCPtr, this, gain, CVector.getCPtr(pos), pos, CVector.getCPtr(velocity), velocity, pitch);
  }

  public void play() {
    nel3dJNI.CPSSoundInstanceImpl_play(swigCPtr, this);
  }

  public boolean isPlaying() {
    return nel3dJNI.CPSSoundInstanceImpl_isPlaying(swigCPtr, this);
  }

  public void stop() {
    nel3dJNI.CPSSoundInstanceImpl_stop(swigCPtr, this);
  }

  public float getPitch() {
    return nel3dJNI.CPSSoundInstanceImpl_getPitch(swigCPtr, this);
  }

  public void setLooping(boolean looping) {
    nel3dJNI.CPSSoundInstanceImpl_setLooping(swigCPtr, this, looping);
  }

  public boolean isLooping() {
    return nel3dJNI.CPSSoundInstanceImpl_isLooping(swigCPtr, this);
  }

  public void release() {
    nel3dJNI.CPSSoundInstanceImpl_release(swigCPtr, this);
  }

}
